Skip to content

refactor(lock): give each manager its own timings, so tests stop writing package globals - #157

Merged
mattmattox merged 1 commit into
mainfrom
claude/lock-per-manager-timing
Nov 16, 2026
Merged

mattmattox merged 1 commit into
mainfrom
claude/lock-per-manager-timing

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

Unblocks #144's Race x3 job. Lock tests shortened holdTurn, cacheGrace, renewAfter, acquireTimeout, tornExpiry and longHold by writing package variables, while cache-expiry timers and watchers from earlier tests still read them. On main, Race x3 on .68 reproduces the reported race: safety_test.go:145's deferred holdTurn restore against another test's expireCached → turnOverLocked.

These six, plus yieldGap and releaseRetry, are now one timings field per Manager, with defaults set in NewManager. Tests set them on their own managers before using them. Runtime behavior does not change.

Evidence (.68, the exact Race x3 command: go test -race -count=3 over lock, journal, inode and dir):

🤖 Generated with Claude Code

…package globals

Lock tests shortened holdTurn, cacheGrace, renewAfter, acquireTimeout,
tornExpiry and longHold by writing package variables and restoring them in a
defer, while cache-expiry timers and watchers started by earlier tests still
read them. The nightly race run caught one: a test's deferred holdTurn
restore against another test's expireCached.

These settings and yieldGap and releaseRetry are now fields of the manager,
set to the defaults in NewManager. Tests set them on the managers they create,
before using them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit 61749af into main Nov 16, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant